﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastDFS.WinForm
{
    public class AppConfig
    {
        private static string prefix = "";

        private static string get(string key, string defaultVal)
        {
            string str = System.Configuration.ConfigurationManager.ConnectionStrings[key].ConnectionString;
            return string.IsNullOrWhiteSpace(str) ? defaultVal : str;
        }
        private static String getSetting(String key, String defaultVal)
        {
            String str = System.Configuration.ConfigurationManager.AppSettings[key];
            return String.IsNullOrWhiteSpace(str) ? defaultVal : str;
        }

        public static readonly string DFS_TRACKER_HOST = getSetting(prefix + "DFS.tracker.host", "");
        public static readonly int DFS_TRACKER_PORT = int.Parse(getSetting(prefix + "DFS.tracker.port", "22122"));

        public static readonly string DFS_TMSTORGE_FILE = getSetting(prefix + "DFS.tmstorage.file", "");
    }
}
